#include <iostream>
#include <string>
class Car
{
public:
    Car(std::string a,std::string b,int c);
    void accelerate(int value);
    void brake(int value);
    void display();
private:
    std::string Band;
    std::string Model;
    int CurrentSpeed;
    int MaxSpeed;
};

Car::Car(std::string band,std::string model,int maxspeed):CurrentSpeed(0)
{
    Band = band;
    Model = model;
    MaxSpeed = maxspeed;
    // CurrentSpeed = 0;
}

void Car::accelerate(int value)
{
    if(CurrentSpeed +value <= MaxSpeed)
        CurrentSpeed = CurrentSpeed + value;
    else std::cout<<"超过最大速度!\n";
}

void Car::brake(int value)
{
    if(CurrentSpeed - value >= 0)
        CurrentSpeed = CurrentSpeed - value;
    else std::cout<<"速度不能低于0!\n";
}
void Car::display()
{
    std::cout<<std::endl;
    std::cout<<"品牌:"<<Band<<"\n"<<"型号:"<<Model<<"\n"<<"最大速度:"<<MaxSpeed<<"\n"<<"当前速度:"<<CurrentSpeed<<std::endl;
    std::cout<<std::endl;
}


int main()
{
    Car a("Wuling Hongguang","Wuling Hongguang V",150);
    a.display();
    a.accelerate(50);
    a.display();
    a.accelerate(100);
    a.display();
    a.accelerate(1);
    a.brake(90);
    a.display();
    a.brake(58);
    a.display();
    a.brake(2);
    a.display();
    a.brake(1);
    return 0;
}